home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text, with CR line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CR]
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [R*ch] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 4d 61 6e 75 61 6c | 20 74 65 78 74 20 61 6e |% Manual| text an|
|00000010| 64 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |d implem|entation|
|00000020| 20 62 79 20 4a 61 61 70 | 20 56 65 72 6d 65 75 6c | by Jaap| Vermeul|
|00000030| 65 6e 0d 5c 73 65 63 74 | 69 6f 6e 7b 53 74 61 6e |en.\sect|ion{Stan|
|00000040| 64 61 72 64 20 4d 6f 64 | 75 6c 65 20 5c 73 65 63 |dard Mod|ule \sec|
|00000050| 74 63 6f 64 65 7b 70 6f | 73 69 78 66 69 6c 65 7d |tcode{po|sixfile}|
|00000060| 7d 0d 5c 62 69 6d 6f 64 | 69 6e 64 65 78 7b 70 6f |}.\bimod|index{po|
|00000070| 73 69 78 66 69 6c 65 7d | 0d 5c 69 6e 64 65 78 69 |sixfile}|.\indexi|
|00000080| 69 7b 70 6f 73 69 78 7d | 7b 66 69 6c 65 20 6f 62 |i{posix}|{file ob|
|00000090| 6a 65 63 74 7d 0d 0d 54 | 68 69 73 20 6d 6f 64 75 |ject}..T|his modu|
|000000a0| 6c 65 20 69 6d 70 6c 65 | 6d 65 6e 74 73 20 73 6f |le imple|ments so|
|000000b0| 6d 65 20 61 64 64 69 74 | 69 6f 6e 61 6c 20 66 75 |me addit|ional fu|
|000000c0| 6e 63 74 69 6f 6e 61 6c | 69 74 79 20 6f 76 65 72 |nctional|ity over|
|000000d0| 20 74 68 65 20 62 75 69 | 6c 74 2d 69 6e 0d 66 69 | the bui|lt-in.fi|
|000000e0| 6c 65 20 6f 62 6a 65 63 | 74 73 2e 20 20 49 6e 20 |le objec|ts. In |
|000000f0| 70 61 72 74 69 63 75 6c | 61 72 2c 20 69 74 20 69 |particul|ar, it i|
|00000100| 6d 70 6c 65 6d 65 6e 74 | 73 20 66 69 6c 65 20 6c |mplement|s file l|
|00000110| 6f 63 6b 69 6e 67 2c 20 | 63 6f 6e 74 72 6f 6c 20 |ocking, |control |
|00000120| 6f 76 65 72 0d 74 68 65 | 20 66 69 6c 65 20 66 6c |over.the| file fl|
|00000130| 61 67 73 2c 20 61 6e 64 | 20 61 6e 20 65 61 73 79 |ags, and| an easy|
|00000140| 20 69 6e 74 65 72 66 61 | 63 65 20 74 6f 20 64 75 | interfa|ce to du|
|00000150| 70 6c 69 63 61 74 65 20 | 74 68 65 20 66 69 6c 65 |plicate |the file|
|00000160| 20 6f 62 6a 65 63 74 2e | 0d 54 68 65 20 6d 6f 64 | object.|.The mod|
|00000170| 75 6c 65 20 64 65 66 69 | 6e 65 73 20 61 20 6e 65 |ule defi|nes a ne|
|00000180| 77 20 66 69 6c 65 20 6f | 62 6a 65 63 74 2c 20 74 |w file o|bject, t|
|00000190| 68 65 20 70 6f 73 69 78 | 66 69 6c 65 20 6f 62 6a |he posix|file obj|
|000001a0| 65 63 74 2e 20 20 49 74 | 0d 68 61 73 20 61 6c 6c |ect. It|.has all|
|000001b0| 20 74 68 65 20 73 74 61 | 6e 64 61 72 64 20 66 69 | the sta|ndard fi|
|000001c0| 6c 65 20 6f 62 6a 65 63 | 74 20 6d 65 74 68 6f 64 |le objec|t method|
|000001d0| 73 20 61 6e 64 20 61 64 | 64 73 20 74 68 65 20 6d |s and ad|ds the m|
|000001e0| 65 74 68 6f 64 73 0d 64 | 65 73 63 72 69 62 65 64 |ethods.d|escribed|
|000001f0| 20 62 65 6c 6f 77 2e 20 | 20 54 68 69 73 20 6d 6f | below. | This mo|
|00000200| 64 75 6c 65 20 6f 6e 6c | 79 20 77 6f 72 6b 73 20 |dule onl|y works |
|00000210| 66 6f 72 20 63 65 72 74 | 61 69 6e 20 66 6c 61 76 |for cert|ain flav|
|00000220| 6f 72 73 20 6f 66 0d 5c | 55 4e 49 58 7b 7d 2c 20 |ors of.\|UNIX{}, |
|00000230| 73 69 6e 63 65 20 69 74 | 20 75 73 65 73 20 5c 63 |since it| uses \c|
|00000240| 6f 64 65 7b 66 63 6e 74 | 6c 28 29 7d 20 66 6f 72 |ode{fcnt|l()} for|
|00000250| 20 66 69 6c 65 20 6c 6f | 63 6b 69 6e 67 2e 0d 0d | file lo|cking...|
|00000260| 54 6f 20 69 6e 73 74 61 | 6e 74 69 61 74 65 20 61 |To insta|ntiate a|
|00000270| 20 70 6f 73 69 78 66 69 | 6c 65 20 6f 62 6a 65 63 | posixfi|le objec|
|00000280| 74 2c 20 75 73 65 20 74 | 68 65 20 5c 63 6f 64 65 |t, use t|he \code|
|00000290| 7b 6f 70 65 6e 28 29 7d | 20 66 75 6e 63 74 69 6f |{open()}| functio|
|000002a0| 6e 20 69 6e 0d 74 68 65 | 20 70 6f 73 69 78 66 69 |n in.the| posixfi|
|000002b0| 6c 65 20 6d 6f 64 75 6c | 65 2e 20 20 54 68 65 20 |le modul|e. The |
|000002c0| 72 65 73 75 6c 74 69 6e | 67 20 6f 62 6a 65 63 74 |resultin|g object|
|000002d0| 20 6c 6f 6f 6b 73 20 61 | 6e 64 20 66 65 65 6c 73 | looks a|nd feels|
|000002e0| 20 72 6f 75 67 68 6c 79 | 0d 74 68 65 20 73 61 6d | roughly|.the sam|
|000002f0| 65 20 61 73 20 61 20 73 | 74 61 6e 64 61 72 64 20 |e as a s|tandard |
|00000300| 66 69 6c 65 20 6f 62 6a | 65 63 74 2e 0d 0d 54 68 |file obj|ect...Th|
|00000310| 65 20 70 6f 73 69 78 66 | 69 6c 65 20 6d 6f 64 75 |e posixf|ile modu|
|00000320| 6c 65 20 64 65 66 69 6e | 65 73 20 74 68 65 20 66 |le defin|es the f|
|00000330| 6f 6c 6c 6f 77 69 6e 67 | 20 63 6f 6e 73 74 61 6e |ollowing| constan|
|00000340| 74 73 3a 0d 0d 5c 72 65 | 6e 65 77 63 6f 6d 6d 61 |ts:..\re|newcomma|
|00000350| 6e 64 7b 5c 69 6e 64 65 | 78 73 75 62 69 74 65 6d |nd{\inde|xsubitem|
|00000360| 7d 7b 28 69 6e 20 6d 6f | 64 75 6c 65 20 70 6f 73 |}{(in mo|dule pos|
|00000370| 69 78 66 69 6c 65 29 7d | 0d 5c 62 65 67 69 6e 7b |ixfile)}|.\begin{|
|00000380| 64 61 74 61 64 65 73 63 | 7d 7b 53 45 45 4b 5f 53 |datadesc|}{SEEK_S|
|00000390| 45 54 7d 0d 6f 66 66 73 | 65 74 20 69 73 20 63 61 |ET}.offs|et is ca|
|000003a0| 6c 63 75 6c 61 74 65 64 | 20 66 72 6f 6d 20 74 68 |lculated| from th|
|000003b0| 65 20 73 74 61 72 74 20 | 6f 66 20 74 68 65 20 66 |e start |of the f|
|000003c0| 69 6c 65 0d 5c 65 6e 64 | 7b 64 61 74 61 64 65 73 |ile.\end|{datades|
|000003d0| 63 7d 0d 0d 5c 62 65 67 | 69 6e 7b 64 61 74 61 64 |c}..\beg|in{datad|
|000003e0| 65 73 63 7d 7b 53 45 45 | 4b 5f 43 55 52 7d 0d 6f |esc}{SEE|K_CUR}.o|
|000003f0| 66 66 73 65 74 20 69 73 | 20 63 61 6c 63 75 6c 61 |ffset is| calcula|
|00000400| 74 65 64 20 66 72 6f 6d | 20 74 68 65 20 63 75 72 |ted from| the cur|
|00000410| 72 65 6e 74 20 70 6f 73 | 69 74 69 6f 6e 20 69 6e |rent pos|ition in|
|00000420| 20 74 68 65 20 66 69 6c | 65 0d 5c 65 6e 64 7b 64 | the fil|e.\end{d|
|00000430| 61 74 61 64 65 73 63 7d | 0d 0d 5c 62 65 67 69 6e |atadesc}|..\begin|
|00000440| 7b 64 61 74 61 64 65 73 | 63 7d 7b 53 45 45 4b 5f |{datades|c}{SEEK_|
|00000450| 45 4e 44 7d 0d 6f 66 66 | 73 65 74 20 69 73 20 63 |END}.off|set is c|
|00000460| 61 6c 63 75 6c 61 74 65 | 64 20 66 72 6f 6d 20 74 |alculate|d from t|
|00000470| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 66 69 |he end o|f the fi|
|00000480| 6c 65 0d 5c 65 6e 64 7b | 64 61 74 61 64 65 73 63 |le.\end{|datadesc|
|00000490| 7d 0d 0d 54 68 65 20 70 | 6f 73 69 78 66 69 6c 65 |}..The p|osixfile|
|000004a0| 20 6d 6f 64 75 6c 65 20 | 64 65 66 69 6e 65 73 20 | module |defines |
|000004b0| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 66 75 |the foll|owing fu|
|000004c0| 6e 63 74 69 6f 6e 73 3a | 0d 0d 5c 72 65 6e 65 77 |nctions:|..\renew|
|000004d0| 63 6f 6d 6d 61 6e 64 7b | 5c 69 6e 64 65 78 73 75 |command{|\indexsu|
|000004e0| 62 69 74 65 6d 7d 7b 28 | 69 6e 20 6d 6f 64 75 6c |bitem}{(|in modul|
|000004f0| 65 20 70 6f 73 69 78 66 | 69 6c 65 29 7d 0d 0d 5c |e posixf|ile)}..\|
|00000500| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|00000510| 6f 70 65 6e 7d 7b 66 69 | 6c 65 6e 61 6d 65 5c 6f |open}{fi|lename\o|
|00000520| 70 74 69 6f 6e 61 6c 7b | 5c 2c 20 6d 6f 64 65 5c |ptional{|\, mode\|
|00000530| 6f 70 74 69 6f 6e 61 6c | 7b 5c 2c 20 62 75 66 73 |optional|{\, bufs|
|00000540| 69 7a 65 7d 7d 7d 0d 20 | 43 72 65 61 74 65 20 61 |ize}}}. |Create a|
|00000550| 20 6e 65 77 20 70 6f 73 | 69 78 66 69 6c 65 20 6f | new pos|ixfile o|
|00000560| 62 6a 65 63 74 20 77 69 | 74 68 20 74 68 65 20 67 |bject wi|th the g|
|00000570| 69 76 65 6e 20 66 69 6c | 65 6e 61 6d 65 20 61 6e |iven fil|ename an|
|00000580| 64 20 6d 6f 64 65 2e 20 | 20 54 68 65 0d 20 5c 76 |d mode. | The. \v|
|00000590| 61 72 7b 66 69 6c 65 6e | 61 6d 65 7d 2c 20 5c 76 |ar{filen|ame}, \v|
|000005a0| 61 72 7b 6d 6f 64 65 7d | 20 61 6e 64 20 5c 76 61 |ar{mode}| and \va|
|000005b0| 72 7b 62 75 66 73 69 7a | 65 7d 20 61 72 67 75 6d |r{bufsiz|e} argum|
|000005c0| 65 6e 74 73 20 61 72 65 | 0d 20 69 6e 74 65 72 70 |ents are|. interp|
|000005d0| 72 65 74 65 64 20 74 68 | 65 20 73 61 6d 65 20 77 |reted th|e same w|
|000005e0| 61 79 20 61 73 20 62 79 | 20 74 68 65 20 62 75 69 |ay as by| the bui|
|000005f0| 6c 74 2d 69 6e 20 5c 63 | 6f 64 65 7b 6f 70 65 6e |lt-in \c|ode{open|
|00000600| 28 29 7d 20 66 75 6e 63 | 74 69 6f 6e 2e 0d 5c 65 |()} func|tion..\e|
|00000610| 6e 64 7b 66 75 6e 63 64 | 65 73 63 7d 0d 0d 5c 62 |nd{funcd|esc}..\b|
|00000620| 65 67 69 6e 7b 66 75 6e | 63 64 65 73 63 7d 7b 66 |egin{fun|cdesc}{f|
|00000630| 69 6c 65 6f 70 65 6e 7d | 7b 66 69 6c 65 6f 62 6a |ileopen}|{fileobj|
|00000640| 65 63 74 7d 0d 20 43 72 | 65 61 74 65 20 61 20 6e |ect}. Cr|eate a n|
|00000650| 65 77 20 70 6f 73 69 78 | 66 69 6c 65 20 6f 62 6a |ew posix|file obj|
|00000660| 65 63 74 20 77 69 74 68 | 20 74 68 65 20 67 69 76 |ect with| the giv|
|00000670| 65 6e 20 73 74 61 6e 64 | 61 72 64 20 66 69 6c 65 |en stand|ard file|
|00000680| 20 6f 62 6a 65 63 74 2e | 0d 20 54 68 65 20 72 65 | object.|. The re|
|00000690| 73 75 6c 74 69 6e 67 20 | 6f 62 6a 65 63 74 20 68 |sulting |object h|
|000006a0| 61 73 20 74 68 65 20 73 | 61 6d 65 20 66 69 6c 65 |as the s|ame file|
|000006b0| 6e 61 6d 65 20 61 6e 64 | 20 6d 6f 64 65 20 61 73 |name and| mode as|
|000006c0| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 0d 20 66 | the ori|ginal. f|
|000006d0| 69 6c 65 20 6f 62 6a 65 | 63 74 2e 0d 5c 65 6e 64 |ile obje|ct..\end|
|000006e0| 7b 66 75 6e 63 64 65 73 | 63 7d 0d 0d 54 68 65 20 |{funcdes|c}..The |
|000006f0| 70 6f 73 69 78 66 69 6c | 65 20 6f 62 6a 65 63 74 |posixfil|e object|
|00000700| 20 64 65 66 69 6e 65 73 | 20 74 68 65 20 66 6f 6c | defines| the fol|
|00000710| 6c 6f 77 69 6e 67 20 61 | 64 64 69 74 69 6f 6e 61 |lowing a|dditiona|
|00000720| 6c 20 6d 65 74 68 6f 64 | 73 3a 0d 0d 5c 72 65 6e |l method|s:..\ren|
|00000730| 65 77 63 6f 6d 6d 61 6e | 64 7b 5c 69 6e 64 65 78 |ewcomman|d{\index|
|00000740| 73 75 62 69 74 65 6d 7d | 7b 28 70 6f 73 69 78 66 |subitem}|{(posixf|
|00000750| 69 6c 65 20 6d 65 74 68 | 6f 64 29 7d 0d 5c 62 65 |ile meth|od)}.\be|
|00000760| 67 69 6e 7b 66 75 6e 63 | 64 65 73 63 7d 7b 6c 6f |gin{func|desc}{lo|
|00000770| 63 6b 7d 7b 66 6d 74 5c | 2c 20 5c 6f 70 74 69 6f |ck}{fmt\|, \optio|
|00000780| 6e 61 6c 7b 6c 65 6e 5c | 6f 70 74 69 6f 6e 61 6c |nal{len\|optional|
|00000790| 7b 5c 2c 20 73 74 61 72 | 74 0d 5c 6f 70 74 69 6f |{\, star|t.\optio|
|000007a0| 6e 61 6c 7b 5c 2c 20 77 | 68 65 6e 63 65 7d 7d 7d |nal{\, w|hence}}}|
|000007b0| 7d 0d 20 4c 6f 63 6b 20 | 74 68 65 20 73 70 65 63 |}. Lock |the spec|
|000007c0| 69 66 69 65 64 20 73 65 | 63 74 69 6f 6e 20 6f 66 |ified se|ction of|
|000007d0| 20 74 68 65 20 66 69 6c | 65 20 74 68 61 74 20 74 | the fil|e that t|
|000007e0| 68 65 20 66 69 6c 65 20 | 6f 62 6a 65 63 74 20 69 |he file |object i|
|000007f0| 73 0d 20 72 65 66 65 72 | 72 69 6e 67 20 74 6f 2e |s. refer|ring to.|
|00000800| 20 20 54 68 65 20 66 6f | 72 6d 61 74 20 69 73 20 | The fo|rmat is |
|00000810| 65 78 70 6c 61 69 6e 65 | 64 0d 20 62 65 6c 6f 77 |explaine|d. below|
|00000820| 20 69 6e 20 61 20 74 61 | 62 6c 65 2e 20 20 54 68 | in a ta|ble. Th|
|00000830| 65 20 5c 76 61 72 7b 6c | 65 6e 7d 20 61 72 67 75 |e \var{l|en} argu|
|00000840| 6d 65 6e 74 20 73 70 65 | 63 69 66 69 65 73 20 74 |ment spe|cifies t|
|00000850| 68 65 20 6c 65 6e 67 74 | 68 20 6f 66 20 74 68 65 |he lengt|h of the|
|00000860| 0d 20 73 65 63 74 69 6f | 6e 20 74 68 61 74 20 73 |. sectio|n that s|
|00000870| 68 6f 75 6c 64 20 62 65 | 20 6c 6f 63 6b 65 64 2e |hould be| locked.|
|00000880| 20 54 68 65 20 64 65 66 | 61 75 6c 74 20 69 73 20 | The def|ault is |
|00000890| 5c 63 6f 64 65 7b 30 7d | 2e 20 5c 76 61 72 7b 73 |\code{0}|. \var{s|
|000008a0| 74 61 72 74 7d 0d 20 73 | 70 65 63 69 66 69 65 73 |tart}. s|pecifies|
|000008b0| 20 74 68 65 20 73 74 61 | 72 74 69 6e 67 20 6f 66 | the sta|rting of|
|000008c0| 66 73 65 74 20 6f 66 20 | 74 68 65 20 73 65 63 74 |fset of |the sect|
|000008d0| 69 6f 6e 2c 20 77 68 65 | 72 65 20 74 68 65 20 64 |ion, whe|re the d|
|000008e0| 65 66 61 75 6c 74 20 69 | 73 0d 20 5c 63 6f 64 65 |efault i|s. \code|
|000008f0| 7b 30 7d 2e 20 20 54 68 | 65 20 5c 76 61 72 7b 77 |{0}. Th|e \var{w|
|00000900| 68 65 6e 63 65 7d 20 61 | 72 67 75 6d 65 6e 74 20 |hence} a|rgument |
|00000910| 73 70 65 63 69 66 69 65 | 73 20 77 68 65 72 65 20 |specifie|s where |
|00000920| 74 68 65 20 6f 66 66 73 | 65 74 20 69 73 0d 20 72 |the offs|et is. r|
|00000930| 65 6c 61 74 69 76 65 20 | 74 6f 2e 20 49 74 20 61 |elative |to. It a|
|00000940| 63 63 65 70 74 73 20 6f | 6e 65 20 6f 66 20 74 68 |ccepts o|ne of th|
|00000950| 65 20 63 6f 6e 73 74 61 | 6e 74 73 20 5c 63 6f 64 |e consta|nts \cod|
|00000960| 65 7b 53 45 45 4b 5f 53 | 45 54 7d 2c 0d 20 5c 63 |e{SEEK_S|ET},. \c|
|00000970| 6f 64 65 7b 53 45 45 4b | 5f 43 55 52 7d 20 6f 72 |ode{SEEK|_CUR} or|
|00000980| 20 5c 63 6f 64 65 7b 53 | 45 45 4b 5f 45 4e 44 7d | \code{S|EEK_END}|
|00000990| 2e 20 20 54 68 65 20 64 | 65 66 61 75 6c 74 20 69 |. The d|efault i|
|000009a0| 73 20 5c 63 6f 64 65 7b | 53 45 45 4b 5f 53 45 54 |s \code{|SEEK_SET|
|000009b0| 7d 2e 0d 20 46 6f 72 20 | 6d 6f 72 65 20 69 6e 66 |}.. For |more inf|
|000009c0| 6f 72 6d 61 74 69 6f 6e | 20 61 62 6f 75 74 20 74 |ormation| about t|
|000009d0| 68 65 20 61 72 67 75 6d | 65 6e 74 73 20 72 65 66 |he argum|ents ref|
|000009e0| 65 72 20 74 6f 20 74 68 | 65 20 66 63 6e 74 6c 0d |er to th|e fcntl.|
|000009f0| 20 6d 61 6e 75 61 6c 20 | 70 61 67 65 20 6f 6e 20 | manual |page on |
|00000a00| 79 6f 75 72 20 73 79 73 | 74 65 6d 2e 0d 5c 65 6e |your sys|tem..\en|
|00000a10| 64 7b 66 75 6e 63 64 65 | 73 63 7d 0d 0d 5c 62 65 |d{funcde|sc}..\be|
|00000a20| 67 69 6e 7b 66 75 6e 63 | 64 65 73 63 7d 7b 66 6c |gin{func|desc}{fl|
|00000a30| 61 67 73 7d 7b 5c 6f 70 | 74 69 6f 6e 61 6c 7b 66 |ags}{\op|tional{f|
|00000a40| 6c 61 67 73 7d 7d 0d 20 | 53 65 74 20 74 68 65 20 |lags}}. |Set the |
|00000a50| 73 70 65 63 69 66 69 65 | 64 20 66 6c 61 67 73 20 |specifie|d flags |
|00000a60| 66 6f 72 20 74 68 65 20 | 66 69 6c 65 20 74 68 61 |for the |file tha|
|00000a70| 74 20 74 68 65 20 66 69 | 6c 65 20 6f 62 6a 65 63 |t the fi|le objec|
|00000a80| 74 20 69 73 20 72 65 66 | 65 72 72 69 6e 67 0d 20 |t is ref|erring. |
|00000a90| 74 6f 2e 20 20 54 68 65 | 20 6e 65 77 20 66 6c 61 |to. The| new fla|
|00000aa0| 67 73 20 61 72 65 20 4f | 52 65 64 20 77 69 74 68 |gs are O|Red with|
|00000ab0| 20 74 68 65 20 6f 6c 64 | 20 66 6c 61 67 73 2c 20 | the old| flags, |
|00000ac0| 75 6e 6c 65 73 73 20 73 | 70 65 63 69 66 69 65 64 |unless s|pecified|
|00000ad0| 0d 20 6f 74 68 65 72 77 | 69 73 65 2e 20 20 54 68 |. otherw|ise. Th|
|00000ae0| 65 20 66 6f 72 6d 61 74 | 20 69 73 20 65 78 70 6c |e format| is expl|
|00000af0| 61 69 6e 65 64 20 62 65 | 6c 6f 77 20 69 6e 20 61 |ained be|low in a|
|00000b00| 20 74 61 62 6c 65 2e 20 | 20 57 69 74 68 6f 75 74 | table. | Without|
|00000b10| 0d 20 74 68 65 20 5c 76 | 61 72 7b 66 6c 61 67 73 |. the \v|ar{flags|
|00000b20| 7d 20 61 72 67 75 6d 65 | 6e 74 0d 20 61 20 73 74 |} argume|nt. a st|
|00000b30| 72 69 6e 67 20 69 6e 64 | 69 63 61 74 69 6e 67 20 |ring ind|icating |
|00000b40| 74 68 65 20 63 75 72 72 | 65 6e 74 20 66 6c 61 67 |the curr|ent flag|
|00000b50| 73 20 69 73 20 72 65 74 | 75 72 6e 65 64 20 28 74 |s is ret|urned (t|
|00000b60| 68 69 73 20 69 73 0d 20 | 74 68 65 20 73 61 6d 65 |his is. |the same|
|00000b70| 20 61 73 20 74 68 65 20 | 27 3f 27 20 6d 6f 64 69 | as the |'?' modi|
|00000b80| 66 69 65 72 29 2e 20 20 | 46 6f 72 20 6d 6f 72 65 |fier). |For more|
|00000b90| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 61 62 6f | informa|tion abo|
|00000ba0| 75 74 20 74 68 65 20 66 | 6c 61 67 73 0d 20 72 65 |ut the f|lags. re|
|00000bb0| 66 65 72 20 74 6f 20 74 | 68 65 20 66 63 6e 74 6c |fer to t|he fcntl|
|00000bc0| 20 6d 61 6e 75 61 6c 20 | 70 61 67 65 20 6f 6e 20 | manual |page on |
|00000bd0| 79 6f 75 72 20 73 79 73 | 74 65 6d 2e 0d 5c 65 6e |your sys|tem..\en|
|00000be0| 64 7b 66 75 6e 63 64 65 | 73 63 7d 0d 0d 5c 62 65 |d{funcde|sc}..\be|
|00000bf0| 67 69 6e 7b 66 75 6e 63 | 64 65 73 63 7d 7b 64 75 |gin{func|desc}{du|
|00000c00| 70 7d 7b 7d 0d 20 44 75 | 70 6c 69 63 61 74 65 20 |p}{}. Du|plicate |
|00000c10| 74 68 65 20 66 69 6c 65 | 20 6f 62 6a 65 63 74 20 |the file| object |
|00000c20| 61 6e 64 20 74 68 65 20 | 75 6e 64 65 72 6c 79 69 |and the |underlyi|
|00000c30| 6e 67 20 66 69 6c 65 20 | 70 6f 69 6e 74 65 72 20 |ng file |pointer |
|00000c40| 61 6e 64 20 66 69 6c 65 | 0d 20 64 65 73 63 72 69 |and file|. descri|
|00000c50| 70 74 6f 72 2e 20 20 54 | 68 65 20 72 65 73 75 6c |ptor. T|he resul|
|00000c60| 74 69 6e 67 20 6f 62 6a | 65 63 74 20 62 65 68 61 |ting obj|ect beha|
|00000c70| 76 65 73 20 61 73 20 69 | 66 20 69 74 20 77 65 72 |ves as i|f it wer|
|00000c80| 65 20 6e 65 77 6c 79 0d | 20 6f 70 65 6e 65 64 2e |e newly.| opened.|
|00000c90| 0d 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0d |.\end{fu|ncdesc}.|
|00000ca0| 0d 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|00000cb0| 7d 7b 64 75 70 32 7d 7b | 66 64 7d 0d 20 44 75 70 |}{dup2}{|fd}. Dup|
|00000cc0| 6c 69 63 61 74 65 20 74 | 68 65 20 66 69 6c 65 20 |licate t|he file |
|00000cd0| 6f 62 6a 65 63 74 20 61 | 6e 64 20 74 68 65 20 75 |object a|nd the u|
|00000ce0| 6e 64 65 72 6c 79 69 6e | 67 20 66 69 6c 65 20 70 |nderlyin|g file p|
|00000cf0| 6f 69 6e 74 65 72 20 61 | 6e 64 20 66 69 6c 65 0d |ointer a|nd file.|
|00000d00| 20 64 65 73 63 72 69 70 | 74 6f 72 2e 20 20 54 68 | descrip|tor. Th|
|00000d10| 65 20 6e 65 77 20 6f 62 | 6a 65 63 74 20 77 69 6c |e new ob|ject wil|
|00000d20| 6c 20 68 61 76 65 20 74 | 68 65 20 67 69 76 65 6e |l have t|he given|
|00000d30| 20 66 69 6c 65 20 64 65 | 73 63 72 69 70 74 6f 72 | file de|scriptor|
|00000d40| 2e 0d 20 4f 74 68 65 72 | 77 69 73 65 20 74 68 65 |.. Other|wise the|
|00000d50| 20 72 65 73 75 6c 74 69 | 6e 67 20 6f 62 6a 65 63 | resulti|ng objec|
|00000d60| 74 20 62 65 68 61 76 65 | 73 20 61 73 20 69 66 20 |t behave|s as if |
|00000d70| 69 74 20 77 65 72 65 20 | 6e 65 77 6c 79 20 6f 70 |it were |newly op|
|00000d80| 65 6e 65 64 2e 0d 5c 65 | 6e 64 7b 66 75 6e 63 64 |ened..\e|nd{funcd|
|00000d90| 65 73 63 7d 0d 0d 5c 62 | 65 67 69 6e 7b 66 75 6e |esc}..\b|egin{fun|
|00000da0| 63 64 65 73 63 7d 7b 66 | 69 6c 65 7d 7b 7d 0d 20 |cdesc}{f|ile}{}. |
|00000db0| 52 65 74 75 72 6e 20 74 | 68 65 20 73 74 61 6e 64 |Return t|he stand|
|00000dc0| 61 72 64 20 66 69 6c 65 | 20 6f 62 6a 65 63 74 20 |ard file| object |
|00000dd0| 74 68 61 74 20 74 68 65 | 20 70 6f 73 69 78 66 69 |that the| posixfi|
|00000de0| 6c 65 20 6f 62 6a 65 63 | 74 20 69 73 20 62 61 73 |le objec|t is bas|
|00000df0| 65 64 0d 20 6f 6e 2e 20 | 20 54 68 69 73 20 69 73 |ed. on. | This is|
|00000e00| 20 73 6f 6d 65 74 69 6d | 65 73 20 6e 65 63 65 73 | sometim|es neces|
|00000e10| 73 61 72 79 20 66 6f 72 | 20 66 75 6e 63 74 69 6f |sary for| functio|
|00000e20| 6e 73 20 74 68 61 74 20 | 69 6e 73 69 73 74 20 6f |ns that |insist o|
|00000e30| 6e 20 61 0d 20 73 74 61 | 6e 64 61 72 64 20 66 69 |n a. sta|ndard fi|
|00000e40| 6c 65 20 6f 62 6a 65 63 | 74 2e 0d 5c 65 6e 64 7b |le objec|t..\end{|
|00000e50| 66 75 6e 63 64 65 73 63 | 7d 0d 0d 41 6c 6c 20 6d |funcdesc|}..All m|
|00000e60| 65 74 68 6f 64 73 20 72 | 65 74 75 72 6e 20 5c 63 |ethods r|eturn \c|
|00000e70| 6f 64 65 7b 49 4f 45 72 | 72 6f 72 7d 20 77 68 65 |ode{IOEr|ror} whe|
|00000e80| 6e 20 74 68 65 20 72 65 | 71 75 65 73 74 20 66 61 |n the re|quest fa|
|00000e90| 69 6c 73 2e 0d 0d 46 6f | 72 6d 61 74 20 63 68 61 |ils...Fo|rmat cha|
|00000ea0| 72 61 63 74 65 72 73 20 | 66 6f 72 20 74 68 65 20 |racters |for the |
|00000eb0| 5c 63 6f 64 65 7b 6c 6f | 63 6b 28 29 7d 20 6d 65 |\code{lo|ck()} me|
|00000ec0| 74 68 6f 64 20 68 61 76 | 65 20 74 68 65 20 66 6f |thod hav|e the fo|
|00000ed0| 6c 6c 6f 77 69 6e 67 20 | 6d 65 61 6e 69 6e 67 3a |llowing |meaning:|
|00000ee0| 0d 0d 5c 62 65 67 69 6e | 7b 74 61 62 6c 65 69 69 |..\begin|{tableii|
|00000ef0| 69 7d 7b 7c 63 7c 6c 7c | 63 7c 7d 7b 73 61 6d 70 |i}{|c|l||c|}{samp|
|00000f00| 7d 7b 46 6f 72 6d 61 74 | 7d 7b 4d 65 61 6e 69 6e |}{Format|}{Meanin|
|00000f10| 67 7d 7b 7d 0d 20 20 5c | 6c 69 6e 65 69 69 69 7b |g}{}. \|lineiii{|
|00000f20| 75 7d 7b 75 6e 6c 6f 63 | 6b 20 74 68 65 20 73 70 |u}{unloc|k the sp|
|00000f30| 65 63 69 66 69 65 64 20 | 72 65 67 69 6f 6e 7d 7b |ecified |region}{|
|00000f40| 7d 0d 20 20 5c 6c 69 6e | 65 69 69 69 7b 72 7d 7b |}. \lin|eiii{r}{|
|00000f50| 72 65 71 75 65 73 74 20 | 61 20 72 65 61 64 20 6c |request |a read l|
|00000f60| 6f 63 6b 20 66 6f 72 20 | 74 68 65 20 73 70 65 63 |ock for |the spec|
|00000f70| 69 66 69 65 64 20 73 65 | 63 74 69 6f 6e 7d 7b 7d |ified se|ction}{}|
|00000f80| 0d 20 20 5c 6c 69 6e 65 | 69 69 69 7b 77 7d 7b 72 |. \line|iii{w}{r|
|00000f90| 65 71 75 65 73 74 20 61 | 20 77 72 69 74 65 20 6c |equest a| write l|
|00000fa0| 6f 63 6b 20 66 6f 72 20 | 74 68 65 20 73 70 65 63 |ock for |the spec|
|00000fb0| 69 66 69 65 64 20 73 65 | 63 74 69 6f 6e 7d 7b 7d |ified se|ction}{}|
|00000fc0| 0d 5c 65 6e 64 7b 74 61 | 62 6c 65 69 69 69 7d 0d |.\end{ta|bleiii}.|
|00000fd0| 0d 49 6e 20 61 64 64 69 | 74 69 6f 6e 20 74 68 65 |.In addi|tion the|
|00000fe0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6d 6f 64 69 66 | followi|ng modif|
|00000ff0| 69 65 72 73 20 63 61 6e | 20 62 65 20 61 64 64 65 |iers can| be adde|
|00001000| 64 20 74 6f 20 74 68 65 | 20 66 6f 72 6d 61 74 3a |d to the| format:|
|00001010| 0d 0d 5c 62 65 67 69 6e | 7b 74 61 62 6c 65 69 69 |..\begin|{tableii|
|00001020| 69 7d 7b 7c 63 7c 6c 7c | 63 7c 7d 7b 73 61 6d 70 |i}{|c|l||c|}{samp|
|00001030| 7d 7b 4d 6f 64 69 66 69 | 65 72 7d 7b 4d 65 61 6e |}{Modifi|er}{Mean|
|00001040| 69 6e 67 7d 7b 4e 6f 74 | 65 73 7d 0d 20 20 5c 6c |ing}{Not|es}. \l|
|00001050| 69 6e 65 69 69 69 7b 7c | 7d 7b 77 61 69 74 20 75 |ineiii{||}{wait u|
|00001060| 6e 74 69 6c 20 74 68 65 | 20 6c 6f 63 6b 20 68 61 |ntil the| lock ha|
|00001070| 73 20 62 65 65 6e 20 67 | 72 61 6e 74 65 64 7d 7b |s been g|ranted}{|
|00001080| 7d 0d 20 20 5c 6c 69 6e | 65 69 69 69 7b 3f 7d 7b |}. \lin|eiii{?}{|
|00001090| 72 65 74 75 72 6e 20 74 | 68 65 20 66 69 72 73 74 |return t|he first|
|000010a0| 20 6c 6f 63 6b 20 63 6f | 6e 66 6c 69 63 74 69 6e | lock co|nflictin|
|000010b0| 67 20 77 69 74 68 20 74 | 68 65 20 72 65 71 75 65 |g with t|he reque|
|000010c0| 73 74 65 64 20 6c 6f 63 | 6b 2c 20 6f 72 0d 20 20 |sted loc|k, or. |
|000010d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 5c 63 6f 64 | | \cod|
|000010e0| 65 7b 4e 6f 6e 65 7d 20 | 69 66 20 74 68 65 72 65 |e{None} |if there|
|000010f0| 20 69 73 20 6e 6f 20 63 | 6f 6e 66 6c 69 63 74 2e | is no c|onflict.|
|00001100| 7d 7b 28 31 29 7d 20 0d | 5c 65 6e 64 7b 74 61 62 |}{(1)} .|\end{tab|
|00001110| 6c 65 69 69 69 7d 0d 0d | 4e 6f 74 65 3a 0d 0d 28 |leiii}..|Note:..(|
|00001120| 31 29 20 54 68 65 20 6c | 6f 63 6b 20 72 65 74 75 |1) The l|ock retu|
|00001130| 72 6e 65 64 20 69 73 20 | 69 6e 20 74 68 65 20 66 |rned is |in the f|
|00001140| 6f 72 6d 61 74 20 5c 63 | 6f 64 65 7b 28 6d 6f 64 |ormat \c|ode{(mod|
|00001150| 65 2c 20 6c 65 6e 2c 20 | 73 74 61 72 74 2c 0d 77 |e, len, |start,.w|
|00001160| 68 65 6e 63 65 2c 20 70 | 69 64 29 7d 20 77 68 65 |hence, p|id)} whe|
|00001170| 72 65 20 6d 6f 64 65 20 | 69 73 20 61 20 63 68 61 |re mode |is a cha|
|00001180| 72 61 63 74 65 72 20 72 | 65 70 72 65 73 65 6e 74 |racter r|epresent|
|00001190| 69 6e 67 20 74 68 65 20 | 74 79 70 65 20 6f 66 20 |ing the |type of |
|000011a0| 6c 6f 63 6b 0d 28 27 72 | 27 20 6f 72 20 27 77 27 |lock.('r|' or 'w'|
|000011b0| 29 2e 20 20 54 68 69 73 | 20 6d 6f 64 69 66 69 65 |). This| modifie|
|000011c0| 72 20 70 72 65 76 65 6e | 74 73 20 61 20 72 65 71 |r preven|ts a req|
|000011d0| 75 65 73 74 20 66 72 6f | 6d 20 62 65 69 6e 67 20 |uest fro|m being |
|000011e0| 67 72 61 6e 74 65 64 3b | 20 69 74 0d 69 73 20 66 |granted;| it.is f|
|000011f0| 6f 72 20 71 75 65 72 79 | 20 70 75 72 70 6f 73 65 |or query| purpose|
|00001200| 73 20 6f 6e 6c 79 2e 0d | 0d 46 6f 72 6d 61 74 20 |s only..|.Format |
|00001210| 63 68 61 72 61 63 74 65 | 72 20 66 6f 72 20 74 68 |characte|r for th|
|00001220| 65 20 5c 63 6f 64 65 7b | 66 6c 61 67 73 28 29 7d |e \code{|flags()}|
|00001230| 20 6d 65 74 68 6f 64 20 | 68 61 76 65 20 74 68 65 | method |have the|
|00001240| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6d 65 61 6e 69 | followi|ng meani|
|00001250| 6e 67 3a 0d 0d 5c 62 65 | 67 69 6e 7b 74 61 62 6c |ng:..\be|gin{tabl|
|00001260| 65 69 69 69 7d 7b 7c 63 | 7c 6c 7c 63 7c 7d 7b 73 |eiii}{|c||l|c|}{s|
|00001270| 61 6d 70 7d 7b 46 6f 72 | 6d 61 74 7d 7b 4d 65 61 |amp}{For|mat}{Mea|
|00001280| 6e 69 6e 67 7d 7b 7d 0d | 20 20 5c 6c 69 6e 65 69 |ning}{}.| \linei|
|00001290| 69 69 7b 61 7d 7b 61 70 | 70 65 6e 64 20 6f 6e 6c |ii{a}{ap|pend onl|
|000012a0| 79 20 66 6c 61 67 7d 7b | 7d 0d 20 20 5c 6c 69 6e |y flag}{|}. \lin|
|000012b0| 65 69 69 69 7b 63 7d 7b | 63 6c 6f 73 65 20 6f 6e |eiii{c}{|close on|
|000012c0| 20 65 78 65 63 20 66 6c | 61 67 7d 7b 7d 0d 20 20 | exec fl|ag}{}. |
|000012d0| 5c 6c 69 6e 65 69 69 69 | 7b 6e 7d 7b 6e 6f 20 64 |\lineiii|{n}{no d|
|000012e0| 65 6c 61 79 20 66 6c 61 | 67 20 28 61 6c 73 6f 20 |elay fla|g (also |
|000012f0| 63 61 6c 6c 65 64 20 6e | 6f 6e 2d 62 6c 6f 63 6b |called n|on-block|
|00001300| 69 6e 67 20 66 6c 61 67 | 29 7d 7b 7d 0d 20 20 5c |ing flag|)}{}. \|
|00001310| 6c 69 6e 65 69 69 69 7b | 73 7d 7b 73 79 6e 63 68 |lineiii{|s}{synch|
|00001320| 72 6f 6e 69 7a 61 74 69 | 6f 6e 20 66 6c 61 67 7d |ronizati|on flag}|
|00001330| 7b 7d 0d 5c 65 6e 64 7b | 74 61 62 6c 65 69 69 69 |{}.\end{|tableiii|
|00001340| 7d 0d 0d 49 6e 20 61 64 | 64 69 74 69 6f 6e 20 74 |}..In ad|dition t|
|00001350| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 6d 6f 64 |he follo|wing mod|
|00001360| 69 66 69 65 72 73 20 63 | 61 6e 20 62 65 20 61 64 |ifiers c|an be ad|
|00001370| 64 65 64 20 74 6f 20 74 | 68 65 20 66 6f 72 6d 61 |ded to t|he forma|
|00001380| 74 3a 0d 0d 5c 62 65 67 | 69 6e 7b 74 61 62 6c 65 |t:..\beg|in{table|
|00001390| 69 69 69 7d 7b 7c 63 7c | 6c 7c 63 7c 7d 7b 73 61 |iii}{|c||l|c|}{sa|
|000013a0| 6d 70 7d 7b 4d 6f 64 69 | 66 69 65 72 7d 7b 4d 65 |mp}{Modi|fier}{Me|
|000013b0| 61 6e 69 6e 67 7d 7b 4e | 6f 74 65 73 7d 0d 20 20 |aning}{N|otes}. |
|000013c0| 5c 6c 69 6e 65 69 69 69 | 7b 21 7d 7b 74 75 72 6e |\lineiii|{!}{turn|
|000013d0| 20 74 68 65 20 73 70 65 | 63 69 66 69 65 64 20 66 | the spe|cified f|
|000013e0| 6c 61 67 73 20 27 6f 66 | 66 27 2c 20 69 6e 73 74 |lags 'of|f', inst|
|000013f0| 65 61 64 20 6f 66 20 74 | 68 65 20 64 65 66 61 75 |ead of t|he defau|
|00001400| 6c 74 20 27 6f 6e 27 7d | 7b 28 31 29 7d 0d 20 20 |lt 'on'}|{(1)}. |
|00001410| 5c 6c 69 6e 65 69 69 69 | 7b 3d 7d 7b 72 65 70 6c |\lineiii|{=}{repl|
|00001420| 61 63 65 20 74 68 65 20 | 66 6c 61 67 73 2c 20 69 |ace the |flags, i|
|00001430| 6e 73 74 65 61 64 20 6f | 66 20 74 68 65 20 64 65 |nstead o|f the de|
|00001440| 66 61 75 6c 74 20 27 4f | 52 27 20 6f 70 65 72 61 |fault 'O|R' opera|
|00001450| 74 69 6f 6e 7d 7b 28 31 | 29 7d 0d 20 20 5c 6c 69 |tion}{(1|)}. \li|
|00001460| 6e 65 69 69 69 7b 3f 7d | 7b 72 65 74 75 72 6e 20 |neiii{?}|{return |
|00001470| 61 20 73 74 72 69 6e 67 | 20 69 6e 20 77 68 69 63 |a string| in whic|
|00001480| 68 20 74 68 65 20 63 68 | 61 72 61 63 74 65 72 73 |h the ch|aracters|
|00001490| 20 72 65 70 72 65 73 65 | 6e 74 20 74 68 65 20 66 | represe|nt the f|
|000014a0| 6c 61 67 73 20 74 68 61 | 74 0d 20 20 61 72 65 20 |lags tha|t. are |
|000014b0| 73 65 74 2e 7d 7b 28 32 | 29 7d 0d 5c 65 6e 64 7b |set.}{(2|)}.\end{|
|000014c0| 74 61 62 6c 65 69 69 69 | 7d 0d 0d 4e 6f 74 65 3a |tableiii|}..Note:|
|000014d0| 0d 0d 28 31 29 20 54 68 | 65 20 5c 63 6f 64 65 7b |..(1) Th|e \code{|
|000014e0| 21 7d 20 61 6e 64 20 5c | 63 6f 64 65 7b 3d 7d 20 |!} and \|code{=} |
|000014f0| 6d 6f 64 69 66 69 65 72 | 73 20 61 72 65 20 6d 75 |modifier|s are mu|
|00001500| 74 75 61 6c 6c 79 20 65 | 78 63 6c 75 73 69 76 65 |tually e|xclusive|
|00001510| 2e 0d 0d 28 32 29 20 54 | 68 69 73 20 73 74 72 69 |...(2) T|his stri|
|00001520| 6e 67 20 72 65 70 72 65 | 73 65 6e 74 73 20 74 68 |ng repre|sents th|
|00001530| 65 20 66 6c 61 67 73 20 | 61 66 74 65 72 20 74 68 |e flags |after th|
|00001540| 65 79 20 6d 61 79 20 68 | 61 76 65 20 62 65 65 6e |ey may h|ave been|
|00001550| 20 61 6c 74 65 72 65 64 | 0d 62 79 20 74 68 65 20 | altered|.by the |
|00001560| 73 61 6d 65 20 63 61 6c | 6c 2e 0d 0d 45 78 61 6d |same cal|l...Exam|
|00001570| 70 6c 65 73 3a 0d 0d 5c | 62 63 6f 64 65 5c 62 65 |ples:..\|bcode\be|
|00001580| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0d 66 72 |gin{verb|atim}.fr|
|00001590| 6f 6d 20 70 6f 73 69 78 | 66 69 6c 65 20 69 6d 70 |om posix|file imp|
|000015a0| 6f 72 74 20 2a 0d 0d 66 | 69 6c 65 20 3d 20 6f 70 |ort *..f|ile = op|
|000015b0| 65 6e 28 27 2f 74 6d 70 | 2f 74 65 73 74 27 2c 20 |en('/tmp|/test', |
|000015c0| 27 77 27 29 0d 66 69 6c | 65 2e 6c 6f 63 6b 28 27 |'w').fil|e.lock('|
|000015d0| 77 7c 27 29 0d 2e 2e 2e | 0d 66 69 6c 65 2e 6c 6f |w|')....|.file.lo|
|000015e0| 63 6b 28 27 75 27 29 0d | 66 69 6c 65 2e 63 6c 6f |ck('u').|file.clo|
|000015f0| 73 65 28 29 0d 5c 65 6e | 64 7b 76 65 72 62 61 74 |se().\en|d{verbat|
|00001600| 69 6d 7d 5c 65 63 6f 64 | 65 0d |im}\ecod|e. |
+--------+-------------------------+-------------------------+--------+--------+